﻿using GrapeCity.Forguncy.Commands;
using GrapeCity.Forguncy.Plugin;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace AndroidPDACommand
{
    [Icon("pack://application:,,,/AndroidPDACommand;component/Resources/Icon_Phone.png")]
    [Category("活字格安卓容器（HAC）")]
    [OrderWeight(990)]
    public class GenericBroadcast_Send : BaseCommand
    {
        [FormulaProperty(false)]
        [DisplayName("广播名称（Action）")]
        public object Action { get; set; }

        [FormulaProperty(false)]
        [DisplayName("类型（IntentType/MIME）")]
        public object IntentType { get; set; }

        [FormulaProperty(false)]
        [DisplayName("数据（IntentData/Uri）")]
        public object DataUri { get; set; }

        [ListProperty]
        [DisplayName("附加数据（IntentExtras）")]
        public List<BroadcastExtraObject> Extras { get; set; }


        public override string ToString()
        {
            return "发送广播";
        }

    }

    public class BroadcastExtraObject
    {
        [DisplayName("数据键值")]
        public string name { get; set; }

        [DisplayName("数据类型")]
        [ComboProperty]
        public BroadcastExtraValueType type { get; set; } = BroadcastExtraValueType.字符串;

        [FormulaProperty]
        [DisplayName("值")]
        public object value { get; set; }
    }

    public enum BroadcastExtraValueType
    {
        字符串 = 0,
        整数 = 1,
        小数 = 2,
        是否 = 3
    }
}
